<template>
  <div class="grant-record">
        <Tabs type="card" :animated="false" v-model="currentTab">
            <TabPane v-for="(menu, index) in menus" :key="menu.id" :name="menu.id + ''" :label="menu.label" v-if="roomDeviceIsExistList[index]">
                <component :is="menu.component" :leaseId="leaseId" :tenantId="tenantId"></component>
            </TabPane>
        </Tabs>
  </div>
</template>

<script>
import lockGrantRecord from './grant-record/lock-grant-record'
import accessGrantRecord from './grant-record/access-grant-record'
export default {
  data () {
    return {
      currentTab: -1,
      menus: [
        {
          id: 1,
          label: '门锁授权记录',
          component: 'lockGrantRecord'
        }, {
          id: 2,
          label: '门禁授权记录',
          component: 'accessGrantRecord'
        }
      ]
    }
  },

  props: {
    leaseId: {
      required: true,
      type: String
    },

    tenantId: {
      required: true,
      type: [Number, String]
    },

    roomDeviceIsExistList: {
      required: true,
      type: Array
    }
  },

  components: {
    lockGrantRecord,
    accessGrantRecord
  },

  computed: {
  },

  mounted () {
    this.currentTab = (this.roomDeviceIsExistList.findIndex((DeviceIsExist) => DeviceIsExist) + 1) + '' // 默
  },

  methods: {}
}
</script>
<style lang='less' scoped>
</style>